home *** CD-ROM | disk | FTP | other *** search
- /*•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- • •
- • File Name: Parasite_Manager.c •
- • ---------- •
- • •
- • Copyright © 1990 Apple Computer, Inc. All Rights Reserved •
- • •
- • Description •
- • ----------- •
- • This file contains the routines of the parasite manager. •
- • The parasite manager will install and remove the SLUDGE parasite. •
- • The SLUDGE parasite is what slows down the machine. •
- • •
- • History •
- • ------- •
- • •
- • Author Date Description •
- • ------------------------------------------------------------------ •
- • Kevin McEntee 2/20/90 Original Implementation •
- • •
- • •
- •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- #include <OSUtils.h>
- #include <Resources.h>
- #include <Memory.h>
-
- #include "Parasite_Manager.h"
- #include "State_Storage_Manager.h"
-
-
- void TRY(Ptr Parasite_Location, long Sludge_Factor);
-
- /*•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- • •
- • Identifier: Install •
- • ----------- •
- • •
- • Description •
- • ----------- •
- • This function installs the SLUDGE parasite and makes it active. •
- • •
- • History •
- • ------- •
- • •
- • Author Date Description •
- • ------------------------------------------------------------------ •
- • Kevin McEntee 2/20/90 Original Implementation •
- • •
- • •
- •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- void Install(Handle cdevStorage, long Sludge_Factor)
- {
- Handle SLUDGE_parasite;
- short rvalue;
- Handle a_trap_vector_address = 0x28;
- Handle jt_vector_address = 0x24;
-
-
- /*••••••••••••••••••••••••••••••••••••••••••
- • •
- • Save the values of the Jump_Trace •
- • a-trap exception vectors. •
- • •
- ••••••••••••••••••••••••••••••••••••••••••*/
- Set_Original_A_TRAP_Exception_Vector_Value(cdevStorage, *a_trap_vector_address);
- Set_Original_JUMP_TRACE_Exception_Vector_Value(cdevStorage, *jt_vector_address);
-
- /*••••••••••••••••••••••••••••••••••••••••••
- • •
- • Load the parasite resource. •
- • •
- ••••••••••••••••••••••••••••••••••••••••••*/
-
-
- SLUDGE_parasite = GetResource('NUGG',0);
-
- rvalue = ResError();
-
- if (rvalue != 0)
- DebugStr("\pGetResource Failed");
-
- DetachResource(SLUDGE_parasite);
- rvalue = ResError();
-
- if (rvalue != 0)
- DebugStr("\pDetachResource Failed");
-
-
- HLock(SLUDGE_parasite);
-
- Set_Location_Of_Parasite_Resource(cdevStorage, SLUDGE_parasite);
-
- /*••••••••••••••••••••••••••••••••••••••••••
- • •
- • Activate the parasite. •
- • •
- ••••••••••••••••••••••••••••••••••••••••••*/
- TRY(*SLUDGE_parasite, Sludge_Factor);
-
- }
-
-
- #include <OSUtils.h>
- void CLEAR_JUMP_TRACE_BIT();
-
-
- /*•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- • •
- • Identifier: remove •
- • ----------- •
- • •
- • Description •
- • ----------- •
- • This function makes the SLUDGE parasite inactive and removes it. •
- • •
- • History •
- • ------- •
- • •
- • Author Date Description •
- • ------------------------------------------------------------------ •
- • Kevin McEntee 2/20/90 Original Implementation •
- • •
- • •
- •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- void remove(Handle cdevStorage)
- {
- Handle SLUDGE_parasite;
- Handle a_trap_vector_address = 0x28;
- Handle jt_vector_address = 0x24;
-
- CLEAR_JUMP_TRACE_BIT();
-
-
- *a_trap_vector_address = Get_Original_A_TRAP_Exception_Vector_Value(cdevStorage);
- *jt_vector_address = Get_Original_JUMP_TRACE_Exception_Vector_Value(cdevStorage);
-
- SLUDGE_parasite = Get_Location_Of_Parasite_Resource(cdevStorage);
- HUnlock(SLUDGE_parasite);
- DisposHandle(SLUDGE_parasite);
-
- }